#include <iostream>
#include <deque>
int main(){
    int M;
    int N;
    std::cin>>M>>N;
    int book[N];
    std::deque<int> bookshelf;
    int count=0;//书架上放了几本书
    for(int i=0;i<N;i++){
        std::cin>>book[i];
    }
    int time=0;//拿了几本书
    for (int i=0;i<N;i++){
        int find=0;
        for (int j=0;j<count;j++){
            if (bookshelf[j]==book[i]){find=1;break;}
        }
        if (find==0){
            time+=1;
            if (count<M){
                count++;
            }else{bookshelf.pop_front();}
            bookshelf.push_back(book[i]);

        }
    }
    std::cout<<time<<std::endl;
    return 0;
}